/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package audio.player;

/**
 *
 * @author głodoś
 */
public class FilterWrapper extends SoundFilter{

    private SoundFilter filter;
    public FilterWrapper(){}

    public synchronized void setFilter(SoundFilter filter){
        this.filter = filter;
    }

    @Override
    public synchronized int getRemainingSize() {
        if(filter!=null){
            return filter.getRemainingSize();
        }
        return super.getRemainingSize();
    }

    @Override
    public synchronized void reset() {
        if(filter!=null){
            filter.reset();
        }else
            super.reset();
    }

    @Override
    public synchronized void filter(byte[] samples, int offset, int length) {
        if(filter!=null){
            filter.filter(samples, offset, length);
        }
    }

}
